package com.company.baidu;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main1 {
    public static void main(String[] args) throws IOException {

        Scanner sc = new Scanner(System.in);

        int t = sc.nextInt();
        List<int[]> ret = new ArrayList<>();

        while (t-- > 0){
            int n = sc.nextInt();
            int m = sc.nextInt();
            int[] people = new int[n];
            for (int i = 0; i < n; i++) {
                people[i] = sc.nextInt();
            }
            int[] actors = new int[m];
            for (int i = 0; i < m; i++) {
                actors[i] = sc.nextInt();
            }
            int[] res = getCandidatingActors(people,actors,n,m);
            ret.add(res);
        }

        for (int i = 0; i < ret.size(); i++) {
            int[] res = ret.get(i);
            for (int j = 0; j < res.length; j++) {
                System.out.print(res[j]);
                if(j != res.length - 1){
                    System.out.print(" ");
                }
            }
            System.out.println();
        }

    }

    private static int[] getCandidatingActors(int[] people, int[] actors,int n,int m) {
        int[] res = new int[n];
        Arrays.sort(actors);
        for (int i = 0; i < n; i++) {
            int temp = people[i];
            if(temp <= actors[0]){
                res[i] = m;
                continue;
            }
            if(temp > actors[m - 1]){
                res[i] = 0;
                continue;
            }
            int left = 0,right = m;
            int mid = 0;
            while (left < right){
                mid = left + ((right - left) >> 1);
                if(actors[mid] < temp){
                    left = mid + 1;
                }else {
                    right = mid;
                }
            }
            res[i] = m - left;
        }
        return res;
    }


}
